Skip to content

Minghan/filter sentry wharton403#406

Merged
minghansun1 merged 2 commits into
masterfrom
minghan/filter-sentry-wharton403
Mar 15, 2026
Merged

Minghan/filter sentry wharton403#406
minghansun1 merged 2 commits into
masterfrom
minghan/filter-sentry-wharton403

Conversation

@minghansun1
Copy link
Copy Markdown
Contributor

No description provided.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates production Sentry configuration to drop a noisy, known error and extends the laundry API wrapper response with additional timing/status details for clients.

Changes:

  • Add a before_send hook in production settings to filter out a specific Wharton 403 Sentry event.
  • Extend laundry machine aggregation to track remaining time in seconds.
  • Add richer per-machine detail fields (time_remaining_seconds, finishes_at, cycle/modifier info, and display status).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
backend/pennmobile/settings/production.py Adds a Sentry before_send filter to suppress a specific recurring error event.
backend/laundry/api_wrapper.py Adds seconds-level remaining time tracking and new per-machine detail fields in the laundry response.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread backend/laundry/api_wrapper.py Outdated
Comment on lines +4 to +28
@@ -21,7 +22,23 @@

# Sentry settings
SENTRY_URL = os.environ.get("SENTRY_URL", "")
sentry_sdk.init(dsn=SENTRY_URL, integrations=[CeleryIntegration(), DjangoIntegration()])


def before_send(event: Event, hint: Hint) -> Event | None:
if (
Comment thread backend/laundry/api_wrapper.py
@minghansun1 minghansun1 force-pushed the minghan/filter-sentry-wharton403 branch from b0aa7ae to eb58f24 Compare March 14, 2026 17:22
@minghansun1 minghansun1 requested review from Copilot and removed request for Copilot March 14, 2026 17:23
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a Sentry before_send hook in the production Django settings to drop a known-noisy Wharton 403 error event before it’s reported.

Changes:

  • Import Sentry SDK type hints (Event, Hint) for the hook signature.
  • Add before_send filter to discard events whose log message contains Wharton: Error 403 when reserving data.
  • Wire before_send into sentry_sdk.init(...) in production.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread backend/pennmobile/settings/production.py Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the backend’s production Sentry configuration to drop a specific noisy error (“Wharton: Error 403 when reserving data”) before it is sent to Sentry, reducing alerting/log noise in production.

Changes:

  • Adds a before_send callback in production.py to filter out events containing the target Wharton 403 message.
  • Updates sentry_sdk.init(...) to register the before_send hook.
  • Introduces type annotations for the callback using sentry_sdk.types.Event and Hint.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Copy link
Copy Markdown
Contributor

@dr-Jess dr-Jess left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@minghansun1 minghansun1 merged commit 4a26ed2 into master Mar 15, 2026
12 checks passed
@minghansun1 minghansun1 deleted the minghan/filter-sentry-wharton403 branch March 15, 2026 04:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants